home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 5 / The 640 Meg Shareware Studio CD-ROM Volume V (Data Express)(1994).ISO / amiga / d_atmb23.lha / ATM_TIME / ATM_interest < prev    next >
Text File  |  1994-02-19  |  4KB  |  91 lines

  1. /**************************************************************************\
  2.       ATM TIME Bank Interest Calculator (Daily & Monthly Maint Module)
  3.  
  4.    $VER: ATM TIME Bank Interest Calculator, v2.3 (20-Feb-94) by Dotoran!
  5. \**************************************************************************/
  6. options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
  7. tr=transmit ; se=sendstring ; gc=getchar ; qu=query
  8. accounts='pfiles:atm/files/accounts' ; date=date('e')
  9. config='pfiles:atm/files/atm_config' ; sflag=0
  10.  
  11. call open(f1,accounts,'r')
  12.     t=readln(f1) ; totacts=word(t,1)
  13.     if totacts=0 then do ; close(f1) ; exit ; end
  14.     do i=1 to 3 ; j=readln(f1) ; end i
  15.     do i=1 to totacts ; atm.i=readln(f1)
  16.         parse var atm.i j tf.i pin.i min.i j j j han.i
  17.     end i
  18. call close(f1)
  19.  
  20. tr 'f1z1cfCalculating Daily ATM Bank Interest for:z0c9 'totacts' caTotal Accounts.n1'
  21.  
  22. call open(f1,config,'r')
  23.     do i=1 to 3 ; con.i=readln(f1) ; end i
  24. call close(f1)
  25.  
  26. parse var con.1 junk junk junk max_min junk
  27. parse var con.3 min_base min_good min_bad junk
  28.  
  29. do i=1 to totacts ; ifile='pfiles:atm/interest/pin'||pin.i||'_INTEREST'
  30.     se 'cbCLIENT:ca'han.i'cf: c9'
  31.     call open(f1,ifile,'r')
  32.         min_total=readln(f1) ; idate=readln(f1)
  33.     call close(f1)
  34.     if idate=date then do ; tr 'Already Calculated For Today!'
  35.         iterate i ; end
  36.     if tf.i=1 & min.i>=min_base then min_total=min_total+min_good
  37.     if tf.i=1 & min.i<min_base  then min_total=min_total-min_bad
  38.     itotal=min_total ; if substr(date,4,2)~=substr(idate,4,2) then mf.i=1
  39.     call open(f1,ifile,'w')
  40.         call writeln(f1,itotal) ; call writeln(f1,date)
  41.     call close(f1)
  42.     tr min_total' cdMinutescf. (ce'date'cf)'
  43. end i
  44.  
  45. tr 'n1z1cfUpdating Monthly Client Records for:z0c9 'totacts' caTotal Accountsn1'
  46.  
  47. do i=1 to totacts
  48.     ifile='pfiles:atm/interest/pin'||pin.i||'_INTEREST'
  49.     tfile='pfiles:atm/time/pin'||pin.i||'_TIME'
  50.     se 'cbCLIENT:ca'han.i'cf:c9 '
  51.     call open(f1,ifile,'r')
  52.         min_total=readln(f1) ; idate=readln(f1)
  53.     call close(f1)
  54.     if mf.i~=1 then do
  55.         tr 'Already Updated this Record!' ; iterate i ; end
  56.     itotal='0' ; min_total=min_total%1
  57.     if min_total+min.i>max_min then min_total=max_min-min.i
  58.     min.i=min.i+min_total ; if min.i<1 & tf.i=1 then min.i=1
  59.     call open(f1,ifile,'w')
  60.         call writeln(f1,itotal) ; call writeln(f1,date)
  61.     call close(f1) ; sflag=1
  62.     atm.i=delword(atm.i,4,1)
  63.     atm.i=insert(' '||left(min.i,3),atm.i,wordindex(atm.i,4)-2)
  64.     ts=sign(min_total) ; if ts<1 then ts=2
  65.     tr abs(min_total)' cdMinutes 'word('cbAdded ceDeducted',ts)'cf.'
  66.     if tf.i=1 then do ; call open(f1,tfile,'a')
  67.         if ts=1 then call writeln(f1,date||' INTEREST DUES OF '||abs(min_total)||' MINUTES.')
  68.         if ts=2 then call writeln(f1,date||' FINANCE CHARGE OF '||abs(min_total)||' MINUTES.')
  69.         call close(f1) ; end
  70. end i
  71.  
  72. if sflag=0 then exit
  73.  
  74. call open(f1,accounts,'w')
  75.     t=left(totacts,4)||'Total Accounts' ; call writeln(f1,t)
  76.     t.1='' ; t.2='ID# T PIN# MIN-Day-Call LastUsed Handle Of Client'
  77.     t.3='-------------------------------------------------'
  78.     do i=1 to 3 ; call writeln(f1,t.i) ; end i
  79.     do i=1 to totacts
  80.         call writeln(f1,atm.i)
  81.     end i
  82. call close(f1)
  83.  
  84. exit
  85.  
  86. SYNTAX: ; ERROR: ; IOERR: ; gu 1311992 ; a=result ; gu 1311960 ; b=result
  87.     er='z4cf'a||b'z0 c9ERRORce: cb'rc' cf(ce'errortext(rc)'cf) c6'
  88.     er=er||'in line ca'sigl'c6.' ; tr 'n1'er ; logentry er ; bufferflush
  89. /** END *******************************************************************\
  90. \****************************************** FRONTIERS BBS (716)/823-9892 **/
  91.